﻿using System;
using Picnic.Spec.Exceptions;

namespace Picnic.Spec.Console.ExceptionWriters
{
	/// <summary>
	/// Represents a writer for <see cref="RequiredExceptionIsNotThrownException"/>.
	/// </summary>
	public class RequiredExceptionIsNotThrownWriter : AbstractExceptionWriter<RequiredExceptionIsNotThrownException>
	{
		/// <summary>
		/// Initializes a new instance of RequiredExceptionIsNotThrownWriter class.
		/// </summary>
		public RequiredExceptionIsNotThrownWriter(ConsoleColor color = ConsoleColor.Red)
			: base(color)
		{
		}

		protected override void WriteException(IConsole console, RequiredExceptionIsNotThrownException exception)
		{
			console.WriteLine("required exception is not thrown");
			console.WriteLine("  required: " + exception.RequiredExceptionType.FullName);
			if (exception.ActualExceptionType != null)
			{
				console.WriteLine("  actual:   " + exception.ActualExceptionType.FullName);
			}
			else
			{
				console.WriteLine("  actual:   (none)");
			}
		}
	}
}